<template>
    <div class=''>
      <input type="text" v-focus="'red'">
    </div>
</template>

<script>
export default {
    data() {
        return {};
    },
    directives:{ // 组件的自定义指令
      focus:{ // focus 是顺便起的
        inserted(el,binding,vnode){
        //   console.log(el)
          console.log(binding)
        //   console.log(vnode);
          el.style.color = binding.value;
          el.focus();
        }
      }
    }
};
</script>

<style lang='scss'>

</style>
